package com.blb.service.impl;

import com.blb.entity.Company;
import com.blb.entity.Order;
import com.blb.entity.Product;
import com.blb.entity.ProductionLine;
import com.blb.mapper.OrderMapper;
import com.blb.service.IOrderService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author HuaHao
 * @since 2019-11-15
 */
@Service
public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements IOrderService {
    @Resource
    private OrderMapper orderMapper;

    @Override
    public List<Map<String,Object>> findAllOrderList(String supplierId,int start, int length, String orderId, String dealTime,String orderStatus) {
        return orderMapper.findAllOrderList(supplierId,start,length,orderId,dealTime,orderStatus);
    }

    @Override
    public int count(String supplierId,String orderId, String dealTime,String orderStatus) {
        return orderMapper.count(supplierId,orderId,dealTime,orderStatus);
    }

    @Override
    public List<Map<String, Object>> getAll(String orderId, Date dealTime) {

        return orderMapper.getAll(orderId,dealTime);
    }

    @Override
    public List<Product> findAllProduct(String companyId) {
        return orderMapper.findAllProduct(companyId);
    }

    @Override
    public List<Company> findAllCustom(String companyId) {
        return orderMapper.findAllCustom(companyId);
    }

    @Override
    public void addOrder(Order order) {
        orderMapper.addOrder(order);
    }

    @Override
    public void updateProduce(Order order) {
        orderMapper.updateProduce(order);
    }

    @Override
    public void updateGoods(Order order) {
        orderMapper.updateGoods(order);
    }

    @Override
    public List<String> findProductById(String companyId) {
        return orderMapper.findProductById(companyId);
    }

    @Override
    public Map<String, Object> findOrderByOrderID(String supplierId,String orderId) {
        return orderMapper.findOrderByOrderID(supplierId,orderId);
    }


    @Override
    public List<Map<String, Object>> findAllSort(String supplierId,int start, int length,String orderId) {
        return orderMapper.findAllSort(supplierId,start,length,orderId);
    }

    @Override
    public int countSort(String supplierId,String orderId) {
        return orderMapper.countSort(supplierId,orderId);
    }

    @Override
    public List<ProductionLine> findAllProductionLine(String companyId) {
        return orderMapper.findAllProductionLine(companyId);
    }

    @Override
    public Order findNumberAndProduction(String orderId,String productLineId) {
        return orderMapper.findNumberAndProduction(orderId,productLineId);
    }

    @Override
    public void updateProductSort(Order order1) {
        orderMapper.updateProductSort(order1);
    }

    @Override
    public void updateOne(String orderId, String productLineId) {
        orderMapper.updateOne(orderId,productLineId);
    }

    @Override
    public Map<String, Object> findStatus(String orderId, String supplierId) {
        return orderMapper.findstatus(orderId,supplierId);
    }


    /**
     * lifeng
     * @param start
     * @param length
     * @param orderId
     * @return
     */
    @Override
    public List<Map<String,Object>> PendingOrder(int start, int length, String orderId,String companyId) {
        return orderMapper.PendingOrder(start, length, orderId,companyId);
    }
    /**
     * lifeng
     * @param orderId
     * @return
     */
    @Override
    public int count2(String orderId,String companyId) {
        return orderMapper.count2(orderId, companyId);
    }

    /**
     * lifeng
     * 加到打印激光列表
     * @param orderId
     * @param productTime
     * @param printer
     * @param productLineId
     */
    @Override
    public void updatePendingOrder(String orderId, String productTime, String printer, int productLineId,String companyId) {
        orderMapper.updatePendingOrder(orderId,productTime,printer,productLineId,companyId);
    }
    /**
     * 将激光码状态从null变为0
     * @param orderId
     * @param companyId
     */
    @Override
    public void updateLStats(String orderId, String companyId) {
        orderMapper.updateLStats(orderId,companyId);
    }

    /**
     * lifeng
     * 消息提醒
     * @return
     */
    @Override
    public int remindNum() {
        return orderMapper.remindNum();
    }
//xuyuanxin
    @Override
    public void updateStatus(String orderId) {
        orderMapper.updateStatus(orderId);
    }
    //xuyuanxin
    @Override
    public void updateVehicle(String orderId) {
        orderMapper.updateVehicle(orderId);
    }
    //xuyuanxin
    @Override
    public void updateDriver(String orderId) {
        orderMapper.updateDriver(orderId);
    }

}
